package com.point_of_sale.cart;

import java.util.HashMap;


public class Cart 
{
	private HashMap<String, Integer> cart;
	
	public Cart()
	{
		cart = new HashMap<String, Integer>(); 
	}
	
	public void addItem(String productCode)
	{
		if(cart.get(productCode) == null)
		{
			cart.put(productCode, 1);
		}
		else
		{
			Integer quantity = cart.get(productCode);
			quantity += 1;
			cart.put(productCode, quantity);
		}
	}
	
	public Integer getQuantity(String productCode)
	{
		return cart.get(productCode);
	}
}
